package com.situ.mall.admin.controller;


import com.situ.mall.base.service.IMemberService;
import com.situ.mall.base.util.C;
import com.situ.mall.base.util.URLUtil;
import com.situ.mall.base.vo.LayuiTableVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import org.springframework.stereotype.Controller;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author darling
 * @since 2023-03-20
 */
@Controller
@RequestMapping(URLUtil.MEMBER)
public class MemberController {

    @Autowired
    private IMemberService memberService;

    // 页面显示
    @GetMapping(URLUtil.PAGE)
    public String page() {
        return URLUtil.MEMBER_HTML;
    }

    // 查所有的会员
    @GetMapping(URLUtil.LIST)
    @ResponseBody
    public LayuiTableVO list(@RequestParam Integer page, @RequestParam Integer limit, String keyword, Integer status){
        return memberService.doList(page, limit, keyword, status);
    }


    // 解除冻结
    @PostMapping(URLUtil.START + URLUtil.UID)
    @ResponseBody
    public void start(@PathVariable(C.ID) Integer id){
        memberService.start(id);
    }

    // 解除冻结
    @PostMapping(URLUtil.STOP + URLUtil.UID)
    @ResponseBody
    public void stop(@PathVariable(C.ID) Integer id){
        memberService.stop(id);
    }



}
